<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_REQUEST["agent_id"])
{
	$calender = new AgentCalender();
	
	$calender->agent_id = strip_tags($_REQUEST["agent_id"]);
	$calender->milestone_date = date("Y-m-d H:m:s", strtotime(strip_tags($_REQUEST["milestone_date"])));
	$calender->alert_action_id = strip_tags($_REQUEST["alert_action_id"]);
	$calender->alert_period = strip_tags($_REQUEST["alert_period"]);
	$calender->cal_item = strip_tags($_REQUEST["cal_item"]);
	$calender->alert_period = strip_tags($_REQUEST["alert_period"]);	
	$calender->created = date("Y-m-d H:m:s");
	$calender->modified = date("Y-m-d H:m:s");
	//$calender->created_by = $created_by;
	//$calender->modified_by = $modified_by;	
	$calender->deleted = 0;

	$calender->save();
	
	$calenderID = $calender->calender_id;	

	$dom = new DomDocument('1.0');
	$dom->formatOutput = true;

	$root = $dom->createElement( "results" );
	$dom->appendChild( $root );
		$dn = $dom->createElement( "record" );
		$dn->setAttribute( 'calenderID', $calenderID );
		$root->appendChild( $dn );	

	header( "Content-type: text/xml");
	echo $dom->saveXML();

}

?>